#include <iostream>
#include <torch/torch.h>

int main()
{
    std::cout << "Torch Application Starting..." << std::endl;

    // 创建张量
    auto tensor = torch::tensor({{1, 2, 3, 4}, {1, 2, 3, 4}});

    // 设备选择
    auto gpu_tensor = tensor.to(torch::kCUDA);
    gpu_tensor *= 4;

    auto x = torch::detach(gpu_tensor);

    std::cout
        << "Torch Application Starting...\n"
        << tensor << std::endl;

    std::cout
        << "Torch Application Starting...\n"
        << gpu_tensor.sin() << std::endl;

    return 0;
}